#include "odolabel.h"

OdoLabel::OdoLabel(QWidget *parent)
  :QWidget(parent), odoValue(99)
{
  uiInit();
}

OdoLabel::~OdoLabel()
{

}

void OdoLabel::uiInit()
{
  mainLayout = new QHBoxLayout(this);

  label = new QLabel(this);
  label->setText(tr("ODO"));
  label->setFont(QFont("黑体", 12, 2, false));
  QPalette txPa;
  txPa.setColor(QPalette::WindowText, Qt::white);
  label->setPalette(txPa);


  lcdNumber = new QLCDNumber(this);
  lcdNumber->setDigitCount(8);
  lcdNumber->display(QString::number(odoValue));

  mainLayout->addWidget(label);
  mainLayout->addWidget(lcdNumber);
  mainLayout->setMargin(0);
  mainLayout->setSpacing(2);

  setFixedSize(160, 30);
}

quint32 OdoLabel::getOdoValue() const
{
  return odoValue;
}

void OdoLabel::setOdoValue(const quint32 &value)
{
  odoValue = value;
  lcdNumber->display(QString::number(odoValue));
}
